home *** CD-ROM | disk | FTP | other *** search
/ Macwelt 4 / Macwelt DVD 4.cdr / Internet / Internet-Utilities / Mac-OS X / darkstat-2.2 / m4 / gettext.m4 / gettext.m4
Encoding:
M4 Source File  |  2002-09-23  |  21.6 KB  |  540 lines

  1. # gettext.m4 serial 14 (gettext-0.11.2)
  2. dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
  3. dnl This file is free software, distributed under the terms of the GNU
  4. dnl General Public License.  As a special exception to the GNU General
  5. dnl Public License, this file may be distributed as part of a program
  6. dnl that contains a configuration script generated by Autoconf, under
  7. dnl the same distribution terms as the rest of that program.
  8. dnl
  9. dnl This file can can be used in projects which are not available under
  10. dnl the GNU General Public License or the GNU Library General Public
  11. dnl License but which still want to provide support for the GNU gettext
  12. dnl functionality.
  13. dnl Please note that the actual code of the GNU gettext library is covered
  14. dnl by the GNU Library General Public License, and the rest of the GNU
  15. dnl gettext package package is covered by the GNU General Public License.
  16. dnl They are *not* in the public domain.
  17.  
  18. dnl Authors:
  19. dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
  20. dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2002.
  21.  
  22. dnl Macro to add for using GNU gettext.
  23.  
  24. dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
  25. dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
  26. dnl    default (if it is not specified or empty) is 'no-libtool'.
  27. dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
  28. dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
  29. dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
  30. dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
  31. dnl    depending on --{enable,disable}-{shared,static} and on the presence of
  32. dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
  33. dnl    $(top_builddir)/intl/libintl.a will be created.
  34. dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
  35. dnl    implementations (in libc or libintl) without the ngettext() function
  36. dnl    will be ignored.
  37. dnl INTLDIR is used to find the intl libraries.  If empty,
  38. dnl    the value `$(top_builddir)/intl/' is used.
  39. dnl
  40. dnl The result of the configuration is one of three cases:
  41. dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
  42. dnl    and used.
  43. dnl    Catalog format: GNU --> install in $(datadir)
  44. dnl    Catalog extension: .mo after installation, .gmo in source tree
  45. dnl 2) GNU gettext has been found in the system's C library.
  46. dnl    Catalog format: GNU --> install in $(datadir)
  47. dnl    Catalog extension: .mo after installation, .gmo in source tree
  48. dnl 3) No internationalization, always use English msgid.
  49. dnl    Catalog format: none
  50. dnl    Catalog extension: none
  51. dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
  52. dnl The use of .gmo is historical (it was needed to avoid overwriting the
  53. dnl GNU format catalogs when building on a platform with an X/Open gettext),
  54. dnl but we keep it in order not to force irrelevant filename changes on the
  55. dnl maintainers.
  56. dnl
  57. AC_DEFUN([AM_GNU_GETTEXT],
  58. [
  59.   dnl Argument checking.
  60.   ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
  61.     [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
  62. ])])])])])
  63.   ifelse([$2], [], , [ifelse([$2], [need-ngettext], ,
  64.     [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
  65. ])])])
  66.   define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
  67.   define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
  68.  
  69.   AC_REQUIRE([AM_PO_SUBDIRS])dnl
  70.   ifelse(gt_included_intl, yes, [
  71.     AC_REQUIRE([AM_INTL_SUBDIR])dnl
  72.   ])
  73.  
  74.   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
  75.   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
  76.   AC_REQUIRE([AC_LIB_RPATH])
  77.  
  78.   AC_MSG_CHECKING([whether NLS is requested])
  79.   dnl Default is enabled NLS
  80.   AC_ARG_ENABLE(nls,
  81.     [  --disable-nls           do not use Native Language Support],
  82.     USE_NLS=$enableval, USE_NLS=yes)
  83.   AC_MSG_RESULT($USE_NLS)
  84.   AC_SUBST(USE_NLS)
  85.  
  86.   ifelse(gt_included_intl, yes, [
  87.     BUILD_INCLUDED_LIBINTL=no
  88.     USE_INCLUDED_LIBINTL=no
  89.   ])
  90.   LIBINTL=
  91.   LTLIBINTL=
  92.   POSUB=
  93.  
  94.   dnl If we use NLS figure out what method
  95.   if test "$USE_NLS" = "yes"; then
  96.     gt_use_preinstalled_gnugettext=no
  97.     ifelse(gt_included_intl, yes, [
  98.       AC_MSG_CHECKING([whether included gettext is requested])
  99.       AC_ARG_WITH(included-gettext,
  100.         [  --with-included-gettext use the GNU gettext library included here],
  101.         nls_cv_force_use_gnu_gettext=$withval,
  102.         nls_cv_force_use_gnu_gettext=no)
  103.       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
  104.  
  105.       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
  106.       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
  107.     ])
  108.         dnl User does not insist on using GNU NLS library.  Figure out what
  109.         dnl to use.  If GNU gettext is available we use this.  Else we have
  110.         dnl to fall back to GNU NLS library.
  111.  
  112.         dnl Add a version number to the cache macros.
  113.         define([gt_api_version], ifelse([$2], [need-ngettext], 2, 1))
  114.         define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
  115.         define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
  116.  
  117.         AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
  118.          [AC_TRY_LINK([#include <libintl.h>
  119. extern int _nl_msg_cat_cntr;
  120. extern int *_nl_domain_bindings;],
  121.             [bindtextdomain ("", "");
  122. return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
  123.             gt_cv_func_gnugettext_libc=yes,
  124.             gt_cv_func_gnugettext_libc=no)])
  125.  
  126.         if test "$gt_cv_func_gnugettext_libc" != "yes"; then
  127.           dnl Sometimes libintl requires libiconv, so first search for libiconv.
  128.           ifelse(gt_included_intl, yes, , [
  129.             AM_ICONV_LINK
  130.           ])
  131.           dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
  132.           dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
  133.           dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
  134.           dnl even if libiconv doesn't exist.
  135.           AC_LIB_LINKFLAGS_BODY([intl])
  136.           AC_CACHE_CHECK([for GNU gettext in libintl],
  137.             gt_cv_func_gnugettext_libintl,
  138.            [gt_save_CPPFLAGS="$CPPFLAGS"
  139.             CPPFLAGS="$CPPFLAGS $INCINTL"
  140.             gt_save_LIBS="$LIBS"
  141.             LIBS="$LIBS $LIBINTL"
  142.             dnl Now see whether libintl exists and does not depend on libiconv.
  143.             AC_TRY_LINK([#include <libintl.h>
  144. extern int _nl_msg_cat_cntr;
  145. extern
  146. #ifdef __cplusplus
  147. "C"
  148. #endif
  149. const char *_nl_expand_alias ();],
  150.               [bindtextdomain ("", "");
  151. return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
  152.               gt_cv_func_gnugettext_libintl=yes,
  153.               gt_cv_func_gnugettext_libintl=no)
  154.             dnl Now see whether libintl exists and depends on libiconv.
  155.             if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
  156.               LIBS="$LIBS $LIBICONV"
  157.               AC_TRY_LINK([#include <libintl.h>
  158. extern int _nl_msg_cat_cntr;
  159. extern
  160. #ifdef __cplusplus
  161. "C"
  162. #endif
  163. const char *_nl_expand_alias ();],
  164.                 [bindtextdomain ("", "");
  165. return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
  166.                [LIBINTL="$LIBINTL $LIBICONV"
  167.                 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
  168.                 gt_cv_func_gnugettext_libintl=yes
  169.                ])
  170.             fi
  171.             CPPFLAGS="$gt_save_CPPFLAGS"
  172.             LIBS="$gt_save_LIBS"])
  173.         fi
  174.  
  175.         dnl If an already present or preinstalled GNU gettext() is found,
  176.         dnl use it.  But if this macro is used in GNU gettext, and GNU
  177.         dnl gettext is already preinstalled in libintl, we update this
  178.         dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
  179.         if test "$gt_cv_func_gnugettext_libc" = "yes" \
  180.            || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
  181.                 && test "$PACKAGE" != gettext; }; then
  182.           gt_use_preinstalled_gnugettext=yes
  183.         else
  184.           dnl Reset the values set by searching for libintl.
  185.           LIBINTL=
  186.           LTLIBINTL=
  187.           INCINTL=
  188.         fi
  189.  
  190.     ifelse(gt_included_intl, yes, [
  191.         if test "$gt_use_preinstalled_gnugettext" != "yes"; then
  192.           dnl GNU gettext is not found in the C library.
  193.           dnl Fall back on included GNU gettext library.
  194.           nls_cv_use_gnu_gettext=yes
  195.         fi
  196.       fi
  197.  
  198.       if test "$nls_cv_use_gnu_gettext" = "yes"; then
  199.         dnl Mark actions used to generate GNU NLS library.
  200.         INTLOBJS="\$(GETTOBJS)"
  201.         BUILD_INCLUDED_LIBINTL=yes
  202.         USE_INCLUDED_LIBINTL=yes
  203.         LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
  204.         LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
  205.         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
  206.       fi
  207.  
  208.       if test "$gt_use_preinstalled_gnugettext" = "yes" \
  209.          || test "$nls_cv_use_gnu_gettext" = "yes"; then
  210.         dnl Mark actions to use GNU gettext tools.
  211.         CATOBJEXT=.gmo
  212.       fi
  213.     ])
  214.  
  215.     if test "$gt_use_preinstalled_gnugettext" = "yes" \
  216.        || test "$nls_cv_use_gnu_gettext" = "yes"; then
  217.       AC_DEFINE(ENABLE_NLS, 1,
  218.         [Define to 1 if translation of program messages to the user's native language
  219.    is requested.])
  220.     else
  221.       USE_NLS=no
  222.     fi
  223.   fi
  224.  
  225.   if test "$USE_NLS" = "yes"; then
  226.  
  227.     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
  228.       if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
  229.         AC_MSG_CHECKING([how to link with libintl])
  230.         AC_MSG_RESULT([$LIBINTL])
  231.         AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
  232.       fi
  233.  
  234.       dnl For backward compatibility. Some packages may be using this.
  235.       AC_DEFINE(HAVE_GETTEXT, 1,
  236.        [Define if the GNU gettext() function is already present or preinstalled.])
  237.       AC_DEFINE(HAVE_DCGETTEXT, 1,
  238.        [Define if the GNU dcgettext() function is already present or preinstalled.])
  239.     fi
  240.  
  241.     dnl We need to process the po/ directory.
  242.     POSUB=po
  243.   fi
  244.  
  245.   ifelse(gt_included_intl, yes, [
  246.     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
  247.     dnl to 'yes' because some of the testsuite requires it.
  248.     if test "$PACKAGE" = gettext; then
  249.       BUILD_INCLUDED_LIBINTL=yes
  250.     fi
  251.  
  252.     dnl Make all variables we use known to autoconf.
  253.     AC_SUBST(BUILD_INCLUDED_LIBINTL)
  254.     AC_SUBST(USE_INCLUDED_LIBINTL)
  255.     AC_SUBST(CATOBJEXT)
  256.     AC_SUBST(INTLOBJS)
  257.  
  258.     dnl For backward compatibility. Some configure.ins may be using this.
  259.     nls_cv_header_intl=
  260.     nls_cv_header_libgt=
  261.  
  262.     dnl For backward compatibility. Some Makefiles may be using this.
  263.     DATADIRNAME=share
  264.     AC_SUBST(DATADIRNAME)
  265.  
  266.     dnl For backward compatibility. Some Makefiles may be using this.
  267.     INSTOBJEXT=.mo
  268.     AC_SUBST(INSTOBJEXT)
  269.  
  270.     dnl For backward compatibility. Some Makefiles may be using this.
  271.     GENCAT=gencat
  272.     AC_SUBST(GENCAT)
  273.  
  274.     dnl Enable libtool support if the surrounding package wishes it.
  275.     INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
  276.     AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
  277.   ])
  278.  
  279.   dnl For backward compatibility. Some Makefiles may be using this.
  280.   INTLLIBS="$LIBINTL"
  281.   AC_SUBST(INTLLIBS)
  282.  
  283.   dnl Make all documented variables known to autoconf.
  284.   AC_SUBST(LIBINTL)
  285.   AC_SUBST(LTLIBINTL)
  286.   AC_SUBST(POSUB)
  287. ])
  288.  
  289.  
  290. dnl Checks for all prerequisites of the po subdirectory,
  291. dnl except for USE_NLS.
  292. AC_DEFUN([AM_PO_SUBDIRS],
  293. [
  294.   AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  295.   AC_REQUIRE([AC_PROG_INSTALL])dnl
  296.   AC_REQUIRE([AM_MKINSTALLDIRS])dnl
  297.  
  298.   dnl Perform the following tests also if --disable-nls has been given,
  299.   dnl because they are needed for "make dist" to work.
  300.  
  301.   dnl Search for GNU msgfmt in the PATH.
  302.   dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
  303.   dnl The second test excludes FreeBSD msgfmt.
  304.   AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  305.     [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
  306.      (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
  307.     :)
  308.   AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  309.  
  310.   dnl Search for GNU xgettext 0.11 or newer in the PATH.
  311.   dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
  312.   dnl The second test excludes FreeBSD xgettext.
  313.   AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  314.     [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
  315.      (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
  316.     :)
  317.   dnl Remove leftover from FreeBSD xgettext call.
  318.   rm -f messages.po
  319.  
  320.   dnl Search for GNU msgmerge 0.11 or newer in the PATH.
  321.   AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
  322.     [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
  323.  
  324.   dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
  325.   dnl Test whether we really found GNU msgfmt.
  326.   if test "$GMSGFMT" != ":"; then
  327.     dnl If it is no GNU msgfmt we define it as : so that the
  328.     dnl Makefiles still can work.
  329.     if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
  330.        (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
  331.       : ;
  332.     else
  333.       GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
  334.       AC_MSG_RESULT(
  335.         [found $GMSGFMT program is not GNU msgfmt; ignore it])
  336.       GMSGFMT=":"
  337.     fi
  338.   fi
  339.  
  340.   dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
  341.   dnl Test whether we really found GNU xgettext.
  342.   if test "$XGETTEXT" != ":"; then
  343.     dnl If it is no GNU xgettext we define it as : so that the
  344.     dnl Makefiles still can work.
  345.     if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
  346.        (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
  347.       : ;
  348.     else
  349.       AC_MSG_RESULT(
  350.         [found xgettext program is not GNU xgettext; ignore it])
  351.       XGETTEXT=":"
  352.     fi
  353.     dnl Remove leftover from FreeBSD xgettext call.
  354.     rm -f messages.po
  355.   fi
  356.  
  357.   AC_OUTPUT_COMMANDS([
  358.     for ac_file in $CONFIG_FILES; do
  359.       # Support "outfile[:infile[:infile...]]"
  360.       case "$ac_file" in
  361.         *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  362.       esac
  363.       # PO directories have a Makefile.in generated from Makefile.in.in.
  364.       case "$ac_file" in */Makefile.in)
  365.         # Adjust a relative srcdir.
  366.         ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
  367.         ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
  368.         ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
  369.         # In autoconf-2.13 it is called $ac_given_srcdir.
  370.         # In autoconf-2.50 it is called $srcdir.
  371.         test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
  372.         case "$ac_given_srcdir" in
  373.           .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
  374.           /*) top_srcdir="$ac_given_srcdir" ;;
  375.           *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
  376.         esac
  377.         if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
  378.           rm -f "$ac_dir/POTFILES"
  379.           test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
  380.           cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[     ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
  381.           # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
  382.           # on $ac_dir but don't depend on user-specified configuration
  383.           # parameters.
  384.           if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
  385.             # The LINGUAS file contains the set of available languages.
  386.             if test -n "$ALL_LINGUAS"; then
  387.               test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
  388.             fi
  389.             ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
  390.             # Hide the ALL_LINGUAS assigment from automake.
  391.             eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
  392.           fi
  393.           case "$ac_given_srcdir" in
  394.             .) srcdirpre= ;;
  395.             *) srcdirpre='$(srcdir)/' ;;
  396.           esac
  397.           POFILES=
  398.           GMOFILES=
  399.           UPDATEPOFILES=
  400.           DUMMYPOFILES=
  401.           for lang in $ALL_LINGUAS; do
  402.             POFILES="$POFILES $srcdirpre$lang.po"
  403.             GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
  404.             UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
  405.             DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
  406.           done
  407.           # CATALOGS depends on both $ac_dir and the user's LINGUAS
  408.           # environment variable.
  409.           INST_LINGUAS=
  410.           if test -n "$ALL_LINGUAS"; then
  411.             for presentlang in $ALL_LINGUAS; do
  412.               useit=no
  413.               if test "%UNSET%" != "$LINGUAS"; then
  414.                 desiredlanguages="$LINGUAS"
  415.               else
  416.                 desiredlanguages="$ALL_LINGUAS"
  417.               fi
  418.               for desiredlang in $desiredlanguages; do
  419.                 # Use the presentlang catalog if desiredlang is
  420.                 #   a. equal to presentlang, or
  421.                 #   b. a variant of presentlang (because in this case,
  422.                 #      presentlang can be used as a fallback for messages
  423.                 #      which are not translated in the desiredlang catalog).
  424.                 case "$desiredlang" in
  425.                   "$presentlang"*) useit=yes;;
  426.                 esac
  427.               done
  428.               if test $useit = yes; then
  429.                 INST_LINGUAS="$INST_LINGUAS $presentlang"
  430.               fi
  431.             done
  432.           fi
  433.           CATALOGS=
  434.           if test -n "$INST_LINGUAS"; then
  435.             for lang in $INST_LINGUAS; do
  436.               CATALOGS="$CATALOGS $lang.gmo"
  437.             done
  438.           fi
  439.           test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
  440.           sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
  441.           for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
  442.             if test -f "$f"; then
  443.               case "$f" in
  444.                 *.orig | *.bak | *~) ;;
  445.                 *) cat "$f" >> "$ac_dir/Makefile" ;;
  446.               esac
  447.             fi
  448.           done
  449.         fi
  450.         ;;
  451.       esac
  452.     done],
  453.    [# Capture the value of obsolete $ALL_LINGUAS because we need it to compute
  454.     # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
  455.     # from automake.
  456.     eval 'ALL_LINGUAS''="$ALL_LINGUAS"'
  457.     # Capture the value of LINGUAS because we need it to compute CATALOGS.
  458.     LINGUAS="${LINGUAS-%UNSET%}"
  459.    ])
  460. ])
  461.  
  462.  
  463. dnl Checks for all prerequisites of the intl subdirectory,
  464. dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
  465. dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
  466. AC_DEFUN([AM_INTL_SUBDIR],
  467. [
  468.   AC_REQUIRE([AC_PROG_INSTALL])dnl
  469.   AC_REQUIRE([AM_MKINSTALLDIRS])dnl
  470.   AC_REQUIRE([AC_PROG_CC])dnl
  471.   AC_REQUIRE([AC_CANONICAL_HOST])dnl
  472.   AC_REQUIRE([AC_PROG_RANLIB])dnl
  473.   AC_REQUIRE([AC_ISC_POSIX])dnl
  474.   AC_REQUIRE([AC_HEADER_STDC])dnl
  475.   AC_REQUIRE([AC_C_CONST])dnl
  476.   AC_REQUIRE([AC_C_INLINE])dnl
  477.   AC_REQUIRE([AC_TYPE_OFF_T])dnl
  478.   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  479.   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
  480.   AC_REQUIRE([AC_FUNC_MMAP])dnl
  481.   AC_REQUIRE([jm_GLIBC21])dnl
  482.  
  483.   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
  484. stdlib.h string.h unistd.h sys/param.h])
  485.   AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
  486. geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
  487. strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
  488.  
  489.   AM_ICONV
  490.   AM_LANGINFO_CODESET
  491.   AM_LC_MESSAGES
  492.  
  493.   dnl intl/plural.c is generated from intl/plural.y. It requires bison,
  494.   dnl because plural.y uses bison specific features. It requires at least
  495.   dnl bison-1.26 because earlier versions generate a plural.c that doesn't
  496.   dnl compile.
  497.   dnl bison is only needed for the maintainer (who touches plural.y). But in
  498.   dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
  499.   dnl the rule in general Makefile. Now, some people carelessly touch the
  500.   dnl files or have a broken "make" program, hence the plural.c rule will
  501.   dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
  502.   dnl present or too old.
  503.   AC_CHECK_PROGS([INTLBISON], [bison])
  504.   if test -z "$INTLBISON"; then
  505.     ac_verc_fail=yes
  506.   else
  507.     dnl Found it, now check the version.
  508.     AC_MSG_CHECKING([version of bison])
  509. changequote(<<,>>)dnl
  510.     ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
  511.     case $ac_prog_version in
  512.       '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
  513.       1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
  514. changequote([,])dnl
  515.          ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
  516.       *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
  517.     esac
  518.     AC_MSG_RESULT([$ac_prog_version])
  519.   fi
  520.   if test $ac_verc_fail = yes; then
  521.     INTLBISON=:
  522.   fi
  523. ])
  524.  
  525.  
  526. AC_DEFUN([AM_MKINSTALLDIRS],
  527. [
  528.   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
  529.   dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
  530.   dnl Try to locate is.
  531.   MKINSTALLDIRS=
  532.   if test -n "$ac_aux_dir"; then
  533.     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
  534.   fi
  535.   if test -z "$MKINSTALLDIRS"; then
  536.     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
  537.   fi
  538.   AC_SUBST(MKINSTALLDIRS)
  539. ])
  540.